package com.xbj.service;

import com.xbj.dao.UserDao;
import com.xbj.dao.UserDaoImpl;
import com.xbj.model.User;
import com.xbj.model.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.Date;

/**
 * Created by JzzZ
 * Date: 2018\7\1 0001
 * Time: 20:15
 * Project: News2.0
 * File description:
 */
@Service
public class UserService {

    //    注入UserDao
    @Autowired
    public UserDao userDao;

    public User login(User user) {
//        UserDao userDao = new UserDaoImpl() ;
        User selectUser = userDao.selectByUsernameAndPassword(user);
        userDao.updateUser(selectUser);
        User newUser = userDao.selectByUsernameAndPassword(user);
        return newUser;

    }

}
